import request from '@/util/request'
import { dealOpts, ORDER, FIRMORDER } from './../api_type'

// 报名
const orderGetList = (params, opts) => {
  return request.post(dealOpts(ORDER + '/getMySellings', opts), params)
}

const orderGetInfo = (params, opts) => {
  return request.get(dealOpts(ORDER + '/getMySellingInfo', opts), params)
}

const orderCreate = (params, opts) => {
  return request.post(dealOpts(ORDER + '/sellerCreate', opts), params)
}

const orderDelete = (params, opts) => {
  return request.get(dealOpts(ORDER + '/delete', opts), params)
}

const orderSellerPay = (params, opts) => {
  return request.get(dealOpts(ORDER + '/sellerPay', opts), params)
}

const orderConfirmConsign = (params, opts) => {
  return request.get(dealOpts(ORDER + '/confirmConsign', opts), params)
}

const orderUnconfirmConsign = (params, opts) => {
  return request.get(dealOpts(ORDER + '/unconfirmConsign', opts), params)
}

const orderRefund = (params, opts) => {
  return request.get(dealOpts(ORDER + '/refund', opts), params)
}

const orderUnrefund = (params, opts) => {
  return request.get(dealOpts(ORDER + '/unrefund', opts), params)
}

const orderGetPayments = (params, opts) => {
  return request.get(dealOpts(ORDER + '/getPayments', opts), params)
}

const orderDeletePayment = (params, opts) => {
  return request.get(dealOpts(ORDER + '/deletePayment', opts), params)
}

const orderConfirmPayment = (params, opts) => {
  return request.get(dealOpts(ORDER + '/confirmPayment', opts), params)
}

const orderGetPaymentInfo = (params, opts) => {
  return request.get(dealOpts(ORDER + '/getPaymentInfo', opts), params)
}

const orderGetBuyerOrders = (params, opts) => {
  return request.get(dealOpts(FIRMORDER + '/getBuyerOrders', opts), params)
}

export default {
  // order
  orderGetList,
  orderGetInfo,
  orderCreate,
  orderDelete,
  orderSellerPay,
  orderConfirmConsign,
  orderUnconfirmConsign,
  orderRefund,
  orderUnrefund,
  orderGetPayments,
  orderDeletePayment,
  orderConfirmPayment,
  orderGetPaymentInfo,
  orderGetBuyerOrders
}
